package cc.zy.base.hr.controller;

import cc.zy.base.common.annotation.ControllerEndpoint;
import cc.zy.base.common.entity.FebsResponse;
import cc.zy.base.common.entity.QywxDeptTree;
import cc.zy.base.common.exception.FebsException;
import cc.zy.base.hr.entity.QywxDept;
import cc.zy.base.hr.service.IQywxDeptService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * @author LiuShuiWang
 * @date 2022/3/8 , 23:25
 * @Description: 注释
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("qywxDept")
public class QywxDeptController {
    private final IQywxDeptService qywxDeptService;

    /**
     * @Author LiuWang
     * @Date 2022/3/9 0:09
     * 获取部门树（下拉选使用）
     */
    @GetMapping("tree")
    @ControllerEndpoint(exceptionMessage = "获取部门树失败!!!")
    public FebsResponse getQywxDeptTree(QywxDept qywxDept) throws FebsException{
        List<QywxDeptTree<QywxDept>> qywxDeptList = qywxDeptService.selectQywxDept();
        return new FebsResponse().success().data(qywxDeptList);
    }

}
